ABOUTDEVELOPERS |
SpatialStream® Code Examples
Parcels with UTFGrid Identify
This example shows how to add click identify capability to the parcel layer in your application using the UTFGrid data. When the map is clicked, an "click" event is triggered and the parcel at the mouse click location will be highlighted as a canvas layer.
var grid = new UtfGrid();
var UTFGridLayer = initUTFGridLayer( BaseTileLayer, esriRequest, grid ); // Create and add utf layer to the map var urlTemplate = "http://dc1.spatialstream.com/GetUTFGrid.aspx?datasource=samplesite.dmp/parceltiles&z={ z }&x={x }&y={y }&output=json&ss_candy=" +Dmp.Env.Connections["SS"]._candy; utfLayer = new UTFGridLayer({ urlTemplate: urlTemplate, title: "ParcelUTF", map.layers.add(utfLayer); // Example of setting up onclick with UTF feature view.on("click", function (event) { event.stopPropagation(); var z = view.zoom; var lat = event.mapPoint.latitude; var lon = event.mapPoint.longitude; var feature = grid.locate(z, lat, lon); view.popup.open({ location: event.mapPoint, if (feature) { view.popup.content = "<table><tbody><tr><td>APN</td><td>" + feature.APN + "</td></tr><tr><td>House Number</td><td>" + feature.HOUSENUM + "</td></tr><tr><td>Street Name</td><td>" + feature.STRNAME + "</td></tr></tbody></table>"; view.popup.content = "No record found in this location!"; view.goTo(event.mapPoint); Run Sample Back To Index |